﻿#pragma once

#include <QtGui>
#include <QtCore>
#include <QObject>
#include <QGraphicsLineItem>

struct LInfo
{
	QString sname;	// 起点item名称
	QString dname;	// 终点item名称

	QPointF spos;	// 起点item坐标
	QPointF dpos;	// 终点item坐标

};
Q_DECLARE_METATYPE(LInfo);

class wqLinkItem : public QGraphicsLineItem
{
public:
	wqLinkItem(const LInfo& lf, QGraphicsItem* parent = NULL);

	void AdjustSourcePos(const QPointF& pos);
	void AdjustDestPos(const QPointF& pos);

protected:
	virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* item, QWidget* wid);
	virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);

private:
	QPointF sourcePoint;
	QPointF destPoint;
};
